﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace InspectorGadget
{
    /// <summary>
    /// A simple storage mechanisms for monitors. The key is the ID of the monitor. 
    /// </summary>
    public class MonitorDB : Dictionary<string, Monitor>
    {
        /// <summary>
        /// retrieve a monitor value. DO NOT USE TO ADD A MONITOR, use AddMonitor(Monitor).
        /// </summary>
        /// <param name="key"></param>
        /// <returns></returns>
        public Monitor this[string key]
        {
            get { return base[key]; }
            set { throw new NotImplementedException("Use the AddMonitor function."); }
        }

        /// <summary>
        /// Add a monitor, override existing if it already exists.
        /// </summary>
        /// <param name="m"></param>
        public void AddMonitor(Monitor m)
        {
            base[m.MonitorID] = m;
        }
    }
}
